package com.cy;
//懒汉式
public class Test15 {
    public static void main(String[] args) {
        Person2 p = Person2.get();
        Person2 pp = Person2.get();
        System.out.println(p==pp);
    }
}
class Person2{
    private Person2(){}

  static   private Person2 p;

    synchronized  static public Person2 get(){
       if(p==null){
    p =new Person2();
       }
       return p;
    }
}
